<template>
    <el-drawer title="操作记录" :visible.sync="drawer" direction="rtl" size='550px'>
        <el-table :data="tableData" border style="width: 100%;"
            :header-cell-style="{background:'#fafafa',color:'#000',fontWeight:400,fontSize:'12px'}"
            :cell-style="{color:'#5a5a5a',fontSize:'12px',fontWeight:400}" max-height='560'>
            <el-table-column prop="handleTime" label="操作时间" width='160'>
            </el-table-column>
            <el-table-column prop="handleName" label="操作用户" width='80'>
            </el-table-column>
            <el-table-column prop="handleType" label="操作类型" width='100'>
            </el-table-column>
            <el-table-column label="操作详情">
                <template slot-scope="scope">
                    <div style='height:80px;overflow:auto'>
                        {{scope.row.handleDetail}}
                    </div>
                </template>
            </el-table-column>
            <div slot="empty">
                <el-empty :image-size='100'></el-empty>
            </div>
        </el-table>
        <el-pagination v-if="tableData.length" @current-change="handleCurrentChange"
            :page-size='payload.limit' layout="prev, pager, next" :total="total" background>
        </el-pagination>
    </el-drawer>
</template>

<script>
    import {
        handleLogList
    } from '@/api/produceController'
    export default {
        data(){
            return {
                tableData:[],
                total:0,
                drawer: false,
                payload: {
                    type: 0,
                    page: 1,
                    limit: 8
                }
            }
        },
        methods:{
            getHandleLogList(data) {
                handleLogList(data).then(res => {
                    if (res.code == 200) {
                        this.tableData = res.data.records
                        this.total = res.data.total
                    }
                })
            },
            open(){
                this.drawer = true
                this.getHandleLogList(this.payload)
            },
            //currentPage 改变时会触发
            handleCurrentChange(val) {
                this.payload.page = val
                this.getHandleLogList(this.payload)
            },
        }
    }
</script>

<style lang="less" scoped>

</style>